package com.otomotion.research.ants.client;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;

public class ViewerInbox extends Thread {
	
	DatagramSocket socket = null;
	byte[] buffer;
	DatagramPacket packet = null;
	String data = null;
	
	ViewerInbox(String data)
	{
		this.data = data;
		try {
			this.socket = new DatagramSocket(4444);
			buffer = new byte[65507];
		} catch (SocketException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public void run()
	{
		while (true)
		{
			packet = new DatagramPacket(buffer,buffer.length);
			try {
				socket.receive(packet);
				data = String.valueOf(packet.getData());
				
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
	}

}
